/**
 * author      : dormi330
 * date        : 2018/6/24
 * project     : mybatis
 * description : TODO
 */

package org.wzq.learn.infrastructure.persist.mybatis;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.wzq.learn.domain.order.TradeOrder;

import java.util.Date;
import java.util.List;


@Mapper
public interface TradeOrderMapper {

    // 插入新数据
    void insert(@Param("eo") TradeOrder eo);

    // 更新状态, 返回更新的条数
    int updateStatus(
            @Param("tenantCode") String tenantCode,
            @Param("tradeOrderId") String tradeOrderId,
            @Param("fromStatus") String fromStatus,

            @Param("toStatus") String toStatus,
            @Param("rejectReason") String rejectReason,
            @Param("updatedAt") Date updatedAt,
            @Param("updatedBy") String updatedBy
    );

    // ============= query ===============

    // 查询 OrderSummary 对应的 TradeOrder
    List<TradeOrder> queryByOrderSummaryId(
            @Param("tenantCode") String tenantCode,
            @Param("orderSummaryId") String orderSummaryId);

    // 查询单个 TradeOrder
    TradeOrder queryById(
            @Param("tenantCode") String tenantCode,
            @Param("id") String id
    );


}
